<div id="addAssignment">

	<g:flashMessage/>
	<g:hasErrors bean="${assignmentInstance}">
		<ul class="errors" role="alert">
			<g:eachError bean="${assignmentInstance}" var="error">
				<li
					<g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>><g:message
						error="${error}" /></li>
			</g:eachError>
		</ul>
	</g:hasErrors>
	<g:form id="frmAddTimeTracker" controller="assignment" action="addAssignmentEvent" class="columns">
			<g:hiddenField name="issue.id" value="${issueId }"/>
			<g:hiddenField name="developmentTask.id" value="${developmentTaskId }"/>
			<g:hiddenField name="deployment.id" value="${deploymentId }"/>
			<table class="searchable tableForm boxSilver">
				<tr>
					<td class="fieldcontain ${hasErrors(bean: assignmentInstance, field: 'requiredByDate', 'error')} required"><label for="dateOfWork"><g:message code="timeTracker.requiredByDate.label" default="Required By" /> <span class="required-indicator">*</span></label></td>
					<td class="fieldcontain ${hasErrors(bean: assignmentInstance, field: 'requiredByDate', 'error')} required"><g:jqDatePicker name="requiredByDate" precision="day" value="${assignmentInstance?.requiredByDate}" /></td>
					<td class="fieldcontain ${hasErrors(bean: assignmentInstance, field: 'person', 'error')} required"><label for="person"><g:message code="assignment.person.label" default="Person" /> <span class="required-indicator">*</span></label></td>
					<td class="fieldcontain ${hasErrors(bean: assignmentInstance, field: 'person', 'error')} required"><g:select id="person" name="person.id" from="${edu.uow.devdocs.Person.list()}" optionKey="id" required="" value="${assignmentInstance?.person?.id}" class="many-to-one"/></td>
				</tr>
				<tr>
					<td class="fieldcontain ${hasErrors(bean: assignmentInstance, field: 'assignmentComment', 'error')} required"><label for="phase"><g:message code="assignment.assignmentComment.label" default="Instructions" /> <span class="required-indicator">*</span></label></td>
					<td class="fieldcontain ${hasErrors(bean: assignmentInstance, field: 'assignmentComment', 'error')} required"><g:textArea id="assignmentComment" name="assignmentComment" required="" value="${assignmentInstance?.assignmentComment?.id}" /></td>
					<g:if test="${developmentTaskId }">
					<td class="fieldcontain ${hasErrors(bean: timeTrackerInstance, field: 'developmentChecklist', 'error')}"><label for="phase"><g:message code="timeTracker.developmentChecklist.label" default="Development Checklist" /></label></td>
					<td class="fieldcontain ${hasErrors(bean: timeTrackerInstance, field: 'developmentChecklist', 'error')}"><g:select noSelection="['':'']" id="developmentChecklist" name="developmentChecklist.id" from="${edu.uow.devdocs.DevelopmentTask.get(developmentTaskId)?.developmentChecklists}" optionKey="id" value="${timeTrackerInstance?.developmentChecklist?.id}" class="many-to-one"/></td>
					</g:if>
				</tr>
			</table>
		<fieldset class="form-actions">
			<g:submitToRemote class="save" value="Assign" controller="assignment" action="addAssignment" update="addAssignment"/>
		</fieldset>
		</g:form>
		<g:if test="${issueId}">
			<g:set var="assignmentList" value="${edu.uow.devdocs.Assignment.findAllByIssue(edu.uow.devdocs.Issue.get(issueId)) }"></g:set>
		</g:if>
		<g:if test="${developmentTaskId}">
			<g:set var="assignmentList" value="${edu.uow.devdocs.Assignment.findAllByDevelopmentTask(edu.uow.devdocs.DevelopmentTask.get(developmentTaskId)) }"></g:set>
		</g:if>
		<g:if test="${developmentChecklistId}">
			<g:set var="assignmentList" value="${edu.uow.devdocs.Assignment.findAllByDevelopmentChecklist(edu.uow.devdocs.DevelopmentChecklist.get(developmentChecklistId)) }"></g:set>
		</g:if>
		<g:if test="${deploymentId}">
			<g:set var="assignmentList" value="${edu.uow.devdocs.Assignment.findAllByDeployment(edu.uow.devdocs.Deployment.get(deploymentId)) }"></g:set>
		</g:if>
			<table class="sortable">
				<thead>
					<tr>
						<th><g:message code="assignment.person.label" default="Person" /></th>
						<th><g:message code="assignment.requiredByDate.label" default="Required By" /></th>
						<th><g:message code="assignment.issue.label" default="Issue" /></th>
						<th><g:message code="assignment.developmentTask.label" default="Task" /></th>
						<th><g:message code="assignment.developmentChecklist.label" default="Development Checklist" /></th>
						<th><g:message code="assignment.assignmentComment.label" default="Comments" /></th>
						<th><g:message code="assignment.status.label" default="Status" /></th>
					</tr>
				</thead>
				<g:each in="${assignmentList}" status="i" var="assignmentInstance">
				<tr>
					<g:render template="/shared/assignment" model="[counter:i,assignmentInstance:assignmentInstance]"/>
				</tr>
				</g:each>
			</table>
</div>